package dynamicGui;

import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JButton;

import netcode.client.Client;


/*
 * Starting Menu
 * 
 * Buttons:
 * private javax.swing.JButton FAQButton;
private javax.swing.JButton QuitButton;
private javax.swing.JButton SelectGameButton;
 */


public class StartingMenuE extends javax.swing.JPanel{

	
	
	/*
	 * Begin Constructors---------------------------------------------------
	 */
	//Default constructor
	public StartingMenuE(int screenSize) {
        super();
        this.setLayout(new GridLayout(0,2, 0, 10));
        
        addSelectGameButton();
        addFAQButton();
        addQuitButton();
	}
    
    /*
	 * End Constructors------------------------------------------------------------------------------------------------
	 */
	
	
	
	
	
	
    /*Begin button Creation Methods---------------------------------------------------------------------------------
     * 
     */
	
	
	//Add FAQButton
	private void addFAQButton(){
		JButton refreshButton = new JButton("FAQ");
    	refreshButton.setPreferredSize(new Dimension(200, 30));
    	this.add(refreshButton);
    	refreshButton.addActionListener(new java.awt.event.ActionListener() {//sets up an actionlistener
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	FAQButtonActionPerformed(evt);
            }
        });
	}
	
	//Add select game button
	//Enzo- This button name is so vague.... 
	//this really means "go to the server list and see all available games"
	private void addSelectGameButton(){
		JButton refreshButton = new JButton("Select from dynamic lobby selection menu");
    	refreshButton.setPreferredSize(new Dimension(200, 30));
    	this.add(refreshButton);
    	refreshButton.addActionListener(new java.awt.event.ActionListener() {//sets up an actionlistener
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	selectGameButtonActionPerformed(evt);
            }
        });
	}

	//Add FAQButton
	private void addQuitButton(){
		JButton refreshButton = new JButton("Quit");
    	refreshButton.setPreferredSize(new Dimension(200, 30));
    	this.add(refreshButton);
    	refreshButton.addActionListener(new java.awt.event.ActionListener() {//sets up an actionlistener
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	quitButtonActionPerformed(evt);
            }
        });
	}
	
    /*
     * End button Creation Methods------------------------------------------------------------------------------------------
     */

	
	
	
	
	
	
    /*
     *ActionListeners begin--------------------------------------------------------------------------------------------------
     */
	
	//Pressing FAQ Button
	private void FAQButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_QuickGameButtonActionPerformed
		try {
	        //Set your page url in this string. For eg, I m using URL for Google Search engine
	        String url = "http://homepages.uwp.edu/dalby001/faq.html";
	        java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
	      }
	      catch (java.io.IOException e) {
	          System.out.println(e.getMessage());
	      }
	}
	//Pressing selectGame Button
	private void selectGameButtonActionPerformed(java.awt.event.ActionEvent evt) {
		MenuCyclingE.displayLobbySelectionMenu();
	}
	
	
	private void quitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_QuickGameButtonActionPerformed
		System.exit(0);
	}
    
    /*
     *ActionListeners end--------------------------------------------------------------------------------------------------
     */
	
	
}

